#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
#define rep(i, a, b) for (int i = (a); i <= (b); i++)
#define per(i, a, b) for (int i = (a); i >= (b); i--)
#define endl '\n'
const int N = 4e4 + 5;

int n, m;
int vis[N], primes[N], tot, phi[N];
ll sum[N];
void init(int n) {
  vis[1] = 1;
  rep(i, 2, n) {
    if (!vis[i]) primes[++tot] = i, phi[i] = i - 1;
    rep(j, 1, tot) {
      ll k = 1ll * primes[j] * i;
      if (k > n) break;
      vis[k] = 1;
      if (i % primes[j])
        phi[k] = (primes[j] - 1) * phi[i];
      else {
        phi[k] = primes[j] * phi[i];
        break;
      }
    }
  }
  sum[1] = 0;
  rep(i, 2, n) sum[i] = sum[i - 1] + phi[i];
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  init(4e4);
  cin >> n;
  if (n == 1)
    cout << 0;
  else
    cout << 3 + sum[n - 1] * 2;
  return 0;
}